#include "cpu/exec/judge_jcc.h"
#include "cpu/reg.h"

int judge_e() {
    return cpu.eflags.ZF;
}

int judge_ne() {
    return !cpu.eflags.ZF;
}

int judge_s() {
    return cpu.eflags.SF;
}

int judge_ns() {
    return !cpu.eflags.SF;
}

int judge_p() {
    return cpu.eflags.PF;
}

int judge_np() {
    return !cpu.eflags.PF;
}

int judge_o() {
    return cpu.eflags.OF;
}

int judge_no() {
    return !cpu.eflags.OF;
}

int judge_b() {
    return cpu.eflags.CF;
}

int judge_nb() {
    return !cpu.eflags.CF;
}

int judge_na() {
    return cpu.eflags.ZF || cpu.eflags.CF;
}

int judge_a() {
    return !judge_na();
}

int judge_l() {
    return (!cpu.eflags.ZF) && (cpu.eflags.OF != cpu.eflags.SF);
}

int judge_ge() {
    return !judge_l();
}

int judge_le() {
    return cpu.eflags.ZF || (cpu.eflags.OF != cpu.eflags.SF);
}

int judge_g() {
    return !judge_le();
}